package com.example.adms.common.mail;

import com.alibaba.fastjson.JSONObject;
import com.example.adms.common.utils.Constants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;

/**
 * 邮件生产者
 */
@Component
public class MailProducer {

    @Autowired
    private KafkaTemplate kafkaTemplate;

    public void fireMail(Mail mail){
        kafkaTemplate.send(Constants.TOPIC_MAIL, JSONObject.toJSONString(mail));
    }
}
